import { DiaryTemplate } from '../types/templates';

// Predefined diary templates based on requirements
export const PREDEFINED_TEMPLATES: DiaryTemplate[] = [
  {
    id: 'daily-reflection',
    name: 'Daily Reflection',
    description: 'General daily journaling with structured reflection',
    icon: 'BookOpen',
    category: 'personal',
    color: '#3B82F6',
    sections: [
      {
        id: 'highlights',
        title: "Today's Highlights",
        prompt: 'What were the best moments of your day?',
        placeholder: 'Describe the positive experiences, achievements, or memorable moments from today...',
        required: true,
        order: 1
      },
      {
        id: 'challenges',
        title: 'Challenges',
        prompt: 'What difficulties did you face today?',
        placeholder: 'Write about any obstacles, problems, or difficult situations you encountered...',
        required: false,
        order: 2
      },
      {
        id: 'lessons',
        title: 'Lessons Learned',
        prompt: 'What did you learn from today\'s experiences?',
        placeholder: 'Reflect on insights, realizations, or knowledge gained today...',
        required: false,
        order: 3
      },
      {
        id: 'tomorrow-goals',
        title: "Tomorrow's Goals",
        prompt: 'What do you want to accomplish tomorrow?',
        placeholder: 'Set intentions and goals for the next day...',
        required: false,
        order: 4
      }
    ],
    defaultTags: ['daily', 'reflection'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'gratitude-journal',
    name: 'Gratitude Journal',
    description: 'Focus on appreciation and positive thinking',
    icon: 'Heart',
    category: 'wellness',
    color: '#EF4444',
    sections: [
      {
        id: 'three-things',
        title: "Three Things I'm Grateful For",
        prompt: 'List three things you\'re grateful for today',
        placeholder: '1. \n2. \n3. ',
        required: true,
        order: 1
      },
      {
        id: 'why-matter',
        title: 'Why They Matter',
        prompt: 'Explain why these things are meaningful to you',
        placeholder: 'Describe the significance and impact of what you\'re grateful for...',
        required: false,
        order: 2
      },
      {
        id: 'feelings',
        title: 'How They Made Me Feel',
        prompt: 'Describe the emotions these brought you',
        placeholder: 'Express the feelings and emotions associated with your gratitude...',
        required: false,
        order: 3
      }
    ],
    defaultTags: ['gratitude', 'positive', 'wellness'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'travel-diary',
    name: 'Travel Diary',
    description: 'Document travel experiences and adventures',
    icon: 'MapPin',
    category: 'travel',
    color: '#F59E0B',
    sections: [
      {
        id: 'location',
        title: 'Location',
        prompt: 'Where are you today?',
        placeholder: 'City, country, specific places visited...',
        required: true,
        order: 1
      },
      {
        id: 'weather',
        title: 'Weather',
        prompt: 'How was the weather?',
        placeholder: 'Describe the weather conditions and how they affected your day...',
        required: false,
        order: 2
      },
      {
        id: 'activities',
        title: 'Activities',
        prompt: 'What did you do today?',
        placeholder: 'List the activities, sights, and experiences from your day...',
        required: true,
        order: 3
      },
      {
        id: 'people-met',
        title: 'People Met',
        prompt: 'Who did you meet or interact with?',
        placeholder: 'Describe interesting people you encountered or traveled with...',
        required: false,
        order: 4
      },
      {
        id: 'memorable-moments',
        title: 'Memorable Moments',
        prompt: 'What moments will you remember most?',
        placeholder: 'Capture the most special or unforgettable parts of your day...',
        required: false,
        order: 5
      }
    ],
    defaultTags: ['travel', 'adventure', 'memories'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'work-log',
    name: 'Work Log',
    description: 'Professional reflection and productivity tracking',
    icon: 'Briefcase',
    category: 'productivity',
    color: '#10B981',
    sections: [
      {
        id: 'tasks-completed',
        title: 'Tasks Completed',
        prompt: 'What did you accomplish today?',
        placeholder: 'List the tasks, projects, or goals you completed...',
        required: true,
        order: 1
      },
      {
        id: 'challenges-faced',
        title: 'Challenges Faced',
        prompt: 'What obstacles did you encounter?',
        placeholder: 'Describe any difficulties, blockers, or problems you faced...',
        required: false,
        order: 2
      },
      {
        id: 'achievements',
        title: 'Achievements',
        prompt: 'What are you proud of today?',
        placeholder: 'Highlight your wins, breakthroughs, or accomplishments...',
        required: false,
        order: 3
      },
      {
        id: 'learning-points',
        title: 'Learning Points',
        prompt: 'What did you learn?',
        placeholder: 'Note new skills, insights, or knowledge gained...',
        required: false,
        order: 4
      },
      {
        id: 'next-steps',
        title: 'Next Steps',
        prompt: 'What\'s on your agenda for tomorrow?',
        placeholder: 'Plan your priorities and tasks for the next workday...',
        required: false,
        order: 5
      }
    ],
    defaultTags: ['work', 'productivity', 'professional'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'mood-tracker',
    name: 'Mood Tracker',
    description: 'Track emotions and mental wellbeing',
    icon: 'Smile',
    category: 'wellness',
    color: '#8B5CF6',
    sections: [
      {
        id: 'current-mood',
        title: 'Current Mood',
        prompt: 'How are you feeling right now?',
        placeholder: 'Describe your current emotional state and mood...',
        required: true,
        order: 1
      },
      {
        id: 'mood-triggers',
        title: 'Mood Triggers',
        prompt: 'What influenced your mood today?',
        placeholder: 'Identify events, people, or situations that affected how you feel...',
        required: false,
        order: 2
      },
      {
        id: 'coping-strategies',
        title: 'Coping Strategies',
        prompt: 'How did you manage difficult emotions?',
        placeholder: 'Note the techniques or activities you used to cope or improve your mood...',
        required: false,
        order: 3
      },
      {
        id: 'energy-level',
        title: 'Energy Level',
        prompt: 'How energetic do you feel? (1-10)',
        placeholder: 'Rate and describe your energy levels throughout the day...',
        required: false,
        order: 4
      },
      {
        id: 'sleep-quality',
        title: 'Sleep Quality',
        prompt: 'How well did you sleep last night?',
        placeholder: 'Reflect on your sleep quality and how it affected your day...',
        required: false,
        order: 5
      }
    ],
    defaultTags: ['mood', 'wellness', 'mental-health'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'goal-setting',
    name: 'Goal Setting',
    description: 'Plan and track progress towards your goals',
    icon: 'Target',
    category: 'productivity',
    color: '#059669',
    sections: [
      {
        id: 'goal-description',
        title: 'Goal Description',
        prompt: 'What goal are you working on?',
        placeholder: 'Clearly describe your goal and what you want to achieve...',
        required: true,
        order: 1
      },
      {
        id: 'action-steps',
        title: 'Action Steps',
        prompt: 'What specific steps will you take?',
        placeholder: 'Break down your goal into actionable steps...',
        required: true,
        order: 2
      },
      {
        id: 'timeline',
        title: 'Timeline',
        prompt: 'When do you want to achieve this?',
        placeholder: 'Set deadlines and milestones for your goal...',
        required: false,
        order: 3
      },
      {
        id: 'progress-update',
        title: 'Progress Update',
        prompt: 'How much progress have you made?',
        placeholder: 'Reflect on your current progress and what you\'ve accomplished...',
        required: false,
        order: 4
      },
      {
        id: 'obstacles',
        title: 'Obstacles',
        prompt: 'What challenges are you facing?',
        placeholder: 'Identify barriers and plan how to overcome them...',
        required: false,
        order: 5
      }
    ],
    defaultTags: ['goals', 'planning', 'productivity'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'dream-journal',
    name: 'Dream Journal',
    description: 'Record and analyze your dreams',
    icon: 'Moon',
    category: 'personal',
    color: '#6366F1',
    sections: [
      {
        id: 'dream-summary',
        title: 'Dream Summary',
        prompt: 'Describe your dream in detail',
        placeholder: 'Write down everything you remember about your dream...',
        required: true,
        order: 1
      },
      {
        id: 'emotions-in-dream',
        title: 'Emotions in Dream',
        prompt: 'How did you feel during the dream?',
        placeholder: 'Describe the emotions you experienced while dreaming...',
        required: false,
        order: 2
      },
      {
        id: 'symbols-themes',
        title: 'Symbols & Themes',
        prompt: 'What symbols or recurring themes did you notice?',
        placeholder: 'Note any significant symbols, people, or themes in your dream...',
        required: false,
        order: 3
      },
      {
        id: 'interpretation',
        title: 'Personal Interpretation',
        prompt: 'What do you think this dream means?',
        placeholder: 'Reflect on possible meanings or connections to your waking life...',
        required: false,
        order: 4
      }
    ],
    defaultTags: ['dreams', 'subconscious', 'sleep'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'health-wellness',
    name: 'Health & Wellness',
    description: 'Track your physical and mental wellbeing',
    icon: 'Activity',
    category: 'wellness',
    color: '#DC2626',
    sections: [
      {
        id: 'physical-activity',
        title: 'Physical Activity',
        prompt: 'What exercise or movement did you do today?',
        placeholder: 'Describe your workouts, walks, or any physical activities...',
        required: false,
        order: 1
      },
      {
        id: 'meals',
        title: 'Meals',
        prompt: 'What did you eat today?',
        placeholder: 'Note your meals and how they made you feel...',
        required: false,
        order: 2
      },
      {
        id: 'water-intake',
        title: 'Water Intake',
        prompt: 'How much water did you drink?',
        placeholder: 'Track your hydration levels throughout the day...',
        required: false,
        order: 3
      },
      {
        id: 'mental-state',
        title: 'Mental State',
        prompt: 'How is your mental health today?',
        placeholder: 'Reflect on your mental and emotional wellbeing...',
        required: true,
        order: 4
      },
      {
        id: 'self-care',
        title: 'Self-Care Activities',
        prompt: 'What did you do to take care of yourself?',
        placeholder: 'List any self-care practices or activities you engaged in...',
        required: false,
        order: 5
      }
    ],
    defaultTags: ['health', 'wellness', 'self-care'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'creative-writing',
    name: 'Creative Writing',
    description: 'Express yourself through creative writing',
    icon: 'Feather',
    category: 'creative',
    color: '#7C3AED',
    sections: [
      {
        id: 'writing-prompt',
        title: 'Writing Prompt',
        prompt: 'What inspired your writing today?',
        placeholder: 'Note the prompt, idea, or inspiration that sparked your creativity...',
        required: false,
        order: 1
      },
      {
        id: 'creative-response',
        title: 'Creative Response',
        prompt: 'Let your creativity flow...',
        placeholder: 'Write your story, poem, or creative piece here...',
        required: true,
        order: 2
      },
      {
        id: 'inspiration-source',
        title: 'Inspiration Source',
        prompt: 'What or who inspired this piece?',
        placeholder: 'Describe what motivated or influenced your creative work...',
        required: false,
        order: 3
      },
      {
        id: 'reflection',
        title: 'Reflection',
        prompt: 'How do you feel about what you created?',
        placeholder: 'Reflect on your creative process and the final result...',
        required: false,
        order: 4
      }
    ],
    defaultTags: ['creative', 'writing', 'inspiration'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  },
  {
    id: 'relationship-log',
    name: 'Relationship Log',
    description: 'Reflect on social connections and interactions',
    icon: 'Users',
    category: 'relationships',
    color: '#EC4899',
    sections: [
      {
        id: 'person-relationship',
        title: 'Person/Relationship',
        prompt: 'Who did you interact with today?',
        placeholder: 'Name the person or describe the relationship...',
        required: true,
        order: 1
      },
      {
        id: 'interaction-summary',
        title: 'Interaction Summary',
        prompt: 'What happened during your interaction?',
        placeholder: 'Describe the conversation, activity, or time spent together...',
        required: true,
        order: 2
      },
      {
        id: 'feelings',
        title: 'Feelings',
        prompt: 'How did this interaction make you feel?',
        placeholder: 'Express your emotions and reactions to the interaction...',
        required: false,
        order: 3
      },
      {
        id: 'insights',
        title: 'Insights',
        prompt: 'What did you learn about yourself or the other person?',
        placeholder: 'Reflect on any realizations or insights gained...',
        required: false,
        order: 4
      },
      {
        id: 'growth',
        title: 'Growth',
        prompt: 'How did this interaction contribute to your personal growth?',
        placeholder: 'Consider how this experience helped you grow or learn...',
        required: false,
        order: 5
      }
    ],
    defaultTags: ['relationships', 'social', 'connections'],
    isCustom: false,
    usageCount: 0,
    isFavorite: false
  }
];

// Helper function to get template by ID
export const getTemplateById = (id: string): DiaryTemplate | undefined => {
  return PREDEFINED_TEMPLATES.find(template => template.id === id);
};

// Helper function to get templates by category
export const getTemplatesByCategory = (category: string): DiaryTemplate[] => {
  return PREDEFINED_TEMPLATES.filter(template => template.category === category);
};